#!/bin/bash

###############case1################
case1_1_expect="successfully."
check_results_case1_1=`./register.sh fbbreg.jpg fbb`
if [[ $check_results_case1_1 == *$case1_1_expect* ]] 
then 
    echo "case1 one face success "
else 
    echo "case1 one face fail"
 fi

case1_2_expect="please make sure there is only one face in the picture."
check_results_case1_2=`./register.sh twoperson.jpg two`
if [[ $check_results_case1_2 == *$case1_2_expect* ]] 
then 
    echo "case1 two face success "
else 
    echo "case1 two face fail"
 fi

###############case2################


case2_1_expect="face routinue cmd line parameters error."
check_results_case2_1=`./register.sh ldhreg.jpg`
if [[ $check_results_case2_1 == *$case2_1_expect* ]] 
then 
    echo "case2 no name entered success "
else 
    echo "case2 no name entered fail"
 fi


case2_2_expect="successfully."
check_results_case2_2=`./register.sh ldhreg.jpg ldh`
if [[ $check_results_case2_2 == *$case2_2_expect* ]] 
then 
    echo "case2 has name entered success "
else 
    echo "case2 has name entered fail"
 fi

###############case3################


case3_1_expect="successfully.."
check_results_case3_1=` ./register.sh fbbreg.jpg fbb fbb`
if [[ $check_results_case3_1 == *$case3_1_expect* ]] 
then 
    echo "case3 has multiple name entered fail "
else 
    echo "case3 has multiple name entered success"
 fi


case3_2_expect="user name: fbb clear done."
check_results_case3_2=`./clear.sh fbb`
if [[ $check_results_case3_2 == *$case3_2_expect* ]] 
then 
    echo "case3 no name entered success "
else 
    echo "case3 no name entered fail"
 fi


###############case4################


case4_1_expect="database(table) clear done."
check_results_case4_1=`./clear.sh`
if [[ $check_results_case4_1 == *$case4_1_expect* ]] 
then 
    echo "case4 clear database success "
else 
    echo "case4 clear database fail"
 fi

###############case5################


case5_1_expect="Database opened, successfully."
check_results_case5_1=`./show.sh`
if [[ $check_results_case5_1 == *$case5_1_expect* ]] 
then 
    echo "case5 Database opened success "
else 
    echo "case5 Database opened fail"
 fi


case5_2_expect="database closed."
check_results_case5_2=`./show.sh`
if [[ $check_results_case5_2 == *$case5_2_expect* ]] 
then 
    echo "case5 database closed success "
else 
    echo "case5 database closed fail"
 fi